Skip to content

Add replyToId for "IM back", "post back", and "message back" originated from Web Chat - #5871

Merged
William Wong (compulim) merged 80 commits into
mainfrom
feat-postback-reply-to-id
Oct 15, 2026
Merged

William Wong (compulim) merged 80 commits into
mainfrom
feat-postback-reply-to-id

Conversation

@compulim

@compulim William Wong (compulim) commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Related to #5862.

Changelog Entry

Added

  • Rich cards: added fill-in of replyToId for "post back" card actions, in PR #5871, by @compulim

Description

When clicking on a card action of type postBack, the outgoing activity will now contain replyToId to reference which activity it was replying to.

Design

Specific Changes

  • Added replyToId to
    • All card action middleware
    • Hook:
      • useSendMessage for IM back
      • useSendMessageaBack for message back
      • useSendPostBack for post back
      • usePerformCardAction for all card action
  • Added InferReactProps<T> for better representing Valibot prop types
  • Changed "stable screenshot" requirement from 2 to 5, each test run added ~300 ms to trade for less flakiness
  • Delayed some tests to show tooltip before taking screenshot
  • I have added tests and executed them locally
  • I have updated CHANGELOG.md
  • I have updated documentation

Review Checklist

This section is for contributors to review your work.

  • Accessibility reviewed (tab order, content readability, alt text, color contrast)
  • Browser and platform compatibilities reviewed
  • CSS styles reviewed (minimal rules, no z-index)
  • Documents reviewed (docs, samples, live demo)
  • Internationalization reviewed (strings, unit formatting)
  • package.json and package-lock.json reviewed
  • Security reviewed (no data URIs, check for nonce leak)
  • Tests reviewed (coverage, legitimacy)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Optional audio content, stricter action validation, incorrect test coverage, and inaccurate API documentation need correction.

8 open findings
What changed in this PR

Adds originating activity IDs to rich-card postback activities and introduces readonly Valibot-derived React prop types.

Changes:

  • Propagates replyToId through card rendering and postback handling.
  • Migrates card wrappers from JavaScript/PropTypes to validated TypeScript.
  • Adds API documentation, changelog entries, and HTML integration tests.
File Description
packages/​react-valibot/​src/​InferReactProps.ts Adds readonly prop inference.
packages/​react-valibot/​src/​index.ts Exports the new type.
packages/​bundle/​src/​adaptiveCards/​createAdaptiveCardsAttachmentMiddleware.tsx Supplies originating activity IDs.
packages/​bundle/​src/​adaptiveCards/​Attachment/​VideoCardContent.tsx Forwards replyToId.
packages/​bundle/​src/​adaptiveCards/​Attachment/​VideoCardAttachment.tsx Adds validated TSX wrapper.
packages/​bundle/​src/​adaptiveCards/​Attachment/​VideoCardAttachment.js Removes legacy wrapper.
packages/​bundle/​src/​adaptiveCards/​Attachment/​ThumbnailCardContent.tsx Forwards replyToId.
packages/​bundle/​src/​adaptiveCards/​Attachment/​ThumbnailCardAttachment.tsx Adds validated TSX wrapper.
packages/​bundle/​src/​adaptiveCards/​Attachment/​ThumbnailCardAttachment.js Removes legacy wrapper.
packages/​bundle/​src/​adaptiveCards/​Attachment/​SignInCardContent.tsx Forwards replyToId.
packages/​bundle/​src/​adaptiveCards/​Attachment/​SignInCardAttachment.tsx Adds validated TSX wrapper.
packages/​bundle/​src/​adaptiveCards/​Attachment/​SignInCardAttachment.js Removes legacy wrapper.
packages/​bundle/​src/​adaptiveCards/​Attachment/​ReceiptCardContent.tsx Forwards replyToId.
packages/​bundle/​src/​adaptiveCards/​Attachment/​ReceiptCardAttachment.tsx Adds validated TSX wrapper.
packages/​bundle/​src/​adaptiveCards/​Attachment/​ReceiptCardAttachment.js Removes legacy wrapper.
packages/​bundle/​src/​adaptiveCards/​Attachment/​private/​directLineSchema.ts Uses the extracted action schema.
packages/​bundle/​src/​adaptiveCards/​Attachment/​private/​directLineCardActionSchema.ts Adds action validation.
packages/​bundle/​src/​adaptiveCards/​Attachment/​OAuthCardContent.tsx Forwards replyToId.
packages/​bundle/​src/​adaptiveCards/​Attachment/​OAuthCardAttachment.tsx Adds validated TSX wrapper.
packages/​bundle/​src/​adaptiveCards/​Attachment/​OAuthCardAttachment.js Removes legacy wrapper.
packages/​bundle/​src/​adaptiveCards/​Attachment/​HeroCardContent.tsx Forwards replyToId.
packages/​bundle/​src/​adaptiveCards/​Attachment/​HeroCardAttachment.tsx Adds validated TSX wrapper.
packages/​bundle/​src/​adaptiveCards/​Attachment/​HeroCardAttachment.js Removes legacy wrapper.
packages/​bundle/​src/​adaptiveCards/​Attachment/​CommonCard.tsx Adds typed common-card rendering.
packages/​bundle/​src/​adaptiveCards/​Attachment/​CommonCard.js Removes legacy implementation.
packages/​bundle/​src/​adaptiveCards/​Attachment/​AudioCardContent.tsx Forwards replyToId.
packages/​bundle/​src/​adaptiveCards/​Attachment/​AudioCardAttachment.tsx Adds validated TSX wrapper.
packages/​bundle/​src/​adaptiveCards/​Attachment/​AudioCardAttachment.js Removes legacy wrapper.
packages/​bundle/​src/​adaptiveCards/​Attachment/​AnimationCardContent.tsx Forwards IDs and autoplay state.
packages/​bundle/​src/​adaptiveCards/​Attachment/​AnimationCardAttachment.tsx Adds validated TSX wrapper.
packages/​bundle/​src/​adaptiveCards/​Attachment/​AnimationCardAttachment.js Removes legacy wrapper.
packages/​bundle/​src/​adaptiveCards/​Attachment/​AdaptiveCardRenderer.tsx Uses the extracted action schema.
packages/​api/​src/​hooks/​middleware/​createDefaultCardActionMiddleware.ts Notes remaining reply handling.
docs/​HOOKS.md Documents hook arguments.
docs/​API.md Documents middleware context.
CHANGELOG.md Records the feature.
__tests__/​html2/​replyToId/​cardAction/​videoCard.html Tests video-card postbacks.
__tests__/​html2/​replyToId/​cardAction/​thumbnailCard.html Tests thumbnail-card postbacks.
__tests__/​html2/​replyToId/​cardAction/​signInCard.html Tests sign-in-card postbacks.
__tests__/​html2/​replyToId/​cardAction/​receiptCard.html Tests receipt-card postbacks.
__tests__/​html2/​replyToId/​cardAction/​oauthCard.html Tests OAuth-card postbacks.
__tests__/​html2/​replyToId/​cardAction/​heroCard.html Tests hero-card postbacks.
__tests__/​html2/​replyToId/​cardAction/​audioCard.html Intended to test audio cards.
__tests__/​html2/​replyToId/​cardAction/​animationCard.html Tests animation-card postbacks.
__tests__/​html2/​replyToId/​cardAction/​adaptiveCard.html Tests Adaptive Card submissions.
__tests__/​html2/​hooks/​useSendPostBack.text.html Tests textual postbacks.
__tests__/​html2/​hooks/​useSendPostBack.replyToId.html Tests hook-level reply IDs.
__tests__/​html2/​hooks/​usePerformCardAction.replyToId.html Tests middleware propagation.

🧠 Review effort: Balanced


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread packages/bundle/src/adaptiveCards/Attachment/AudioCardAttachment.tsx Outdated
Comment thread __tests__/html2/replyToId/cardAction/audioCard.html Outdated
Comment thread docs/API.md Outdated
Comment thread docs/HOOKS.md
Comment thread packages/bundle/src/adaptiveCards/Attachment/HeroCardAttachment.tsx Outdated
Comment thread packages/bundle/src/adaptiveCards/Attachment/OAuthCardAttachment.tsx Outdated
Comment thread packages/bundle/src/adaptiveCards/createAdaptiveCardsAttachmentMiddleware.tsx Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Card-action validation introduces compatibility regressions, and the development harness does not honor the screenshot stabilization opt-out.

2 open findings
1 resolved since last review
Previously missed (2)

In code that hasn't changed since last review

Medium severity Tap action parsing strips supplied titles

packages/​bundle/​src/​adaptiveCards/​Attachment/​private/​directLineCardActionSchema.ts:146

The essence schemas use object() without presentation fields, so parsing a tap action now discards its supplied title. ThumbnailCardContent always parses images[].tap, then passes it to AdaptiveCardBuilder.addImage(), which uses that title for the image action. This loses the action label and, for submitted actions, the title passed to middleware. Preserve optional presentation fields on headless actions rather than stripping them.

Medium severity Development harness ignores stable=false screenshot option

packages/​test/​harness/​src/​host/​common/​host/​snapshot.js:18

The development harness ignores stable: false: createDevProxies.js:16 replaces this function with host/dev/hostOverrides/snapshot.js, which always calls takeStabilizedScreenshot(). The updated copy-button test therefore still waits for stabilization when run interactively and can miss the transient Copied state; continuously animated pages still time out despite the opt-out. Apply the same screenshot-selection logic in the development override.

🧠 Review effort: Balanced

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Tap-action metadata is lost during parsing, and development screenshots ignore the new stability opt-out.

2 open findings
2 resolved since last review

🧠 Review effort: Balanced

Comment thread packages/test/harness/src/host/common/host/snapshot.js

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

A dispatch-order regression remains, and the broader runtime-validation and screenshot changes require human regression verification.

1 open finding
2 resolved since last review

🧠 Review effort: Balanced

Comment thread packages/component/src/hooks/useSendMessage.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Cross-cutting validation, card rendering, and screenshot timing changes need human confirmation of browser integration results.

0 open findings

1 resolved since last review

🧠 Review effort: Balanced

@compulim William Wong (compulim) changed the title [WIP] Add replyToId for "IM back", "post back", and "message back" originated from Web Chat Add replyToId for "IM back", "post back", and "message back" originated from Web Chat Oct 15, 2026
@compulim
William Wong (compulim) marked this pull request as ready for review October 15, 2026 17:47
Comment thread packages/bundle/src/adaptiveCards/Attachment/VideoCardContent.tsx
@compulim
William Wong (compulim) merged commit 1f4e9bc into main Oct 15, 2026
33 checks passed
@compulim
William Wong (compulim) deleted the feat-postback-reply-to-id branch October 15, 2026 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants